package world.criver.h50529.controller;

import javafx.application.Platform;
import javafx.fxml.Initializable;
import javafx.scene.control.Label;
import world.criver.crkey.crKey;
import world.criver.h50529.data.daControllers;
import world.criver.h50529.data.daData;
import world.criver.h50529.function.funFiles;
import world.criver.h50529.function.funTray;

import java.net.URL;
import java.util.ResourceBundle;

public class conPopMenu {
    public Label state;
    public Label show_hide;

    public void onOpen() {
//        new crKey("h50529");
        if(daData.master.isShowing())daData.master.hide();
        else daData.master.show();
        updateMenus();
    }

    public void onStart() {
        daControllers.page1.onStart();
        updateMenus();
    }

    public void onExit() {
        new funTray().remove();
        funFiles ff=new funFiles();
        ff.saveListens();
        ff.saveEvents();
        System.exit(0);
    }
    public void updateMenus(){
        state.setText(daData.start_listen?"停止":"启动");
        show_hide.setText(daData.master.isShowing()?"关闭":"打开");
    }
}
